package com.txy.service.impl;


import com.alibaba.dubbo.config.annotation.Service;
import com.txy.service.TestService;

import java.util.concurrent.TimeUnit;

@Service
public class TestServiceImpl implements TestService {
    @Override
    public String methodA() {
        try {
            TimeUnit.MILLISECONDS.sleep(getRandom());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "A";
    }

    @Override
    public String methodB() {
        try {
            TimeUnit.MILLISECONDS.sleep(getRandom());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "B";
    }

    @Override
    public String methodC() {
        try {
            TimeUnit.MILLISECONDS.sleep(getRandom());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "C";
    }

    public int getRandom() {
        int max = 100, min = 1;
        int ran2 = (int) (Math.random() * (max - min) + min);
        return ran2;
    }

}
